<script setup>
// >> start hooks 封装
import { reactive, toRef, toRefs } from 'vue';
import pw from '@/hooks/userPassword';
let a = pw();
console.log(a.num.value);
// << end

let sum = ref(10);
/// 响应式数据类型
let obj = reactive({
    name: 'zhang san',
    age: 18,
    sex: '男'
});
// 解构某一个值。
let name = toRef(obj, 'name');
//解构多个值，在template里面直接使用 {{name}}
let { name2, age2 } = toRefs(obj);
obj.name = 'sdf';

const gAppTitle = ref('');
onShow(() => {
    console.log('222');
    // 读取全局常量：
    let text = getApp().globalData.app_title;
    console.log(text);
    gAppTitle.value = text;
});

// console.log(gAppTitle.value);
</script>

<template>
    <view>{{ obj }}</view>
    <view>--》{{ gAppTitle }}</view>
</template>

<style lang="scss"></style>
